package com.itheima.mvcconfig;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer;

public class WebInitConfig extends AbstractDispatcherServletInitializer {

    // 创建springMvc容器
    @Override
    protected WebApplicationContext createServletApplicationContext() {
        AnnotationConfigWebApplicationContext app = new AnnotationConfigWebApplicationContext();
        app.register(SpringMvcConfig.class);
        return app;
    }

    //拦截什么请求
    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};  //忽略静态资源
    }

    @Override
    protected WebApplicationContext createRootApplicationContext() {
        return null;
    }
}
